local table_utils = {}

function table_utils.getNum(tb)
    local count = 0
    for _,_ in pairs(tb) do
        count = count + 1
    end
    return count
end

function table_utils.tostring(tb)

    local str = "{"

    for k,v in pairs(tb) do

        local ok = true

        str = str .. "\n"
        if type(k) == "string" then
             str = str .. "[\"" .. k .. "\"] = "
        elseif type(k) == "number" then
            str = str .. "[" .. tostring(k) .. "] = "
        else
            ok = false
        end

        if ok then
            if type(v) == "string" then
                str = str .. "\"" .. v .. "\","
            elseif type(v) == "number" then
                str = str .. tostring(v) .. ","
            elseif type(v) == "table" then
                str = str .. "\n" ..table_utils.tostring(v) .. ","
            else
                str = str .. "nil,"
            end
        end

    end

    str = str .. "\n}"

    return str

end

return table_utils